<script setup>
import { ref } from 'vue'
import component02 from './components/component02.vue'

// 1. current file
// const text = ref(null)

// onMounted(() => {
//   console.log(text.value)
// })

// 2. son componentq
const subText = ref(null)
const printSubText = () => {
  console.log(subText.value.newMsg)
  subText.value.printMsg()
}
</script>
<template>
  <div class="box">
    <p ref="text">test dom</p>
    <button @click="printText">clickPrint</button>
    <component02 ref="subText"></component02>
    <button @click="printSubText">clickChildPrint</button>
  </div>
</template>

<style lang="scss" scoped>
.box {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  padding: 20px;
}

.my-button {
  display: inline-block;
  text-align: center;
  vertical-align: middle;
  padding: 15px 32px;
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  border-radius: 4px;
  border: none;
  cursor: pointer;

  background-color: #4caf50;
  color: white;

  transition: background-color 0.3s ease;
  &:hover {
    background-color: #45a049;
  }

  &:active {
    background-color: #388e3c;
  }
}
</style>
